# Author: Lovy
# File : mainPage
# Time : 2023-03-21 20:37
from common.basePage import BasePage
from pageObjects.pmPageObjectPage.addProductPage import AddProductPage
from pageObjects.pmPageObjectPage.brandManagePage import BrandManagePage, AddBrandPage
from pageObjects.pmPageObjectPage.productListPage import ProductListPage


class MainPage(BasePage):
    def goto_addproductpage(self):
        self.click_element(self.menu_productmanage)
        self.click_element(self.submenu_pm_addproduct)
        return AddProductPage()

    def goto_productlistpage(self):
        self.click_element(self.menu_productmanage)
        self.click_element(self.submenu_pm_productlist)
        return ProductListPage()

    def goto_brandmanagepage(self):
        self.click_element(self.menu_productmanage)
        self.click_element(self.submenu_pm_brandmanage)
        return BrandManagePage()




if __name__ == '__main__':
    from pageObjects.loginPage import LoginPage
    from configs.env import Env
    test_flag = 2
    if test_flag == 2:
        test_mainpage = LoginPage().open_loginpage(Env.HOST).login_polly("花西子035", "123456")
        test_mainpage.goto_addproductpage()

    if test_flag == 1:
        test_loginpage = LoginPage()
        test_loginpage.open_url(Env.HOST)
        test_loginpage.login_polly("花西子035", "123456")
        test_mainpage = MainPage()
        test_mainpage.goto_addproductpage()







